<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
	
<%
	request.setCharacterEncoding("UTF-8");
	String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/WEB-INF/JSP/backHome/modalWindows/StudentsListPage.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
<link rel="stylesheet" type="text/css" href="<%=path%>/CSS/backLayout.css">
<link rel="stylesheet" type="text/css" href="<%=path%>/CSS/bombBox.css">
</head>
<style>
select{width: 234px;height: 31px}
.gn_name{padding-top: 5px}
.div_zilei{width: 90%;height: 30px}
.tr{height:40px;font-weight: 700}
.tr td{font-size: 14px;background: #57a0ff;color: #ffffff}
.tr_td{height: 40px;}
.tr_td td{border-bottom: 1px solid #ededed;text-align: center;}
tr td:nth-child(1) {font-size: 14px;color: #cccccc}
.date{border: 0;background: #ffffff;text-align: center;}
.tr_td td:nth-child(1){border-left: 1px solid #cccccc;}
.tr_td td:nth-child(3){border-right: 1px solid #cccccc;}
.addTable.deleteTable:HOVER{cursor:pointer;}
type[type='checkbox']{width: 15px}
#table1 input{width: 150px}
#table2 input{width: 150px;}
.fseq2{width:25px;border:none;color:#cccccc;text-align: center;}
#tbyd_content_id{margin-top: 5px;}
#tbyd_content_id .ty{border: #000;font-size: 17px; }
#tbyd_content_id .jiacu{border: #000;font-size: 16px;}
.jiacu{margin-top: 5px;}
	#content_id span{ color: #000000;}
#content_id table tr td {color: #000000;}
#content_id{ width: 820px; padding: 0 20px}
	#content_id table tr td{ height: 20px;}
.div_input_hang {
	width: 100%;
	height: 40px;
}
.input_hang {
	float: left;
	width: 500px;
	height: 40px;
}
</style>
<body style="background: #f5f5f5">
<div class="main">
<div id="modal-overlay">
			    
			</div>
			<div class="modal-data">
				<div style="height: 60px">
				 <ul>
				  	<li  style="text-align: left;margin-left: 60px;height: 40px;line-height: 40px">
				  		<span>名称：</span>
				  		<span>
				  		 	<input class="name" type="text" >
				  		</span>
				  		<span>
				  			<button class="findBtn">
				  				查询
				  			</button>
				  		</span>
				  	</li>
				 </ul>
				</div>
				<div style="width:auto; height:350px; overflow:scroll;">
				      <form action="">
				        <table class="head2" style="width: auto;white-space:nowrap;border-spacing: 0px">
				        <tr style="background: #f2f2f2;height: 30px;line-height: 20px;" class="sel">
					        <td style="width: 20px"></td> 
					        <td>名称</td>
					        <td>编码</td>
					        <td>简称</td>
					        <td>描述</td>
					        <td>创建时间</td>
					        <td>用户名</td>
					        <td>最后修改时间</td>
					        <td>用户名</td>
					        <td>财务组织</td>
				        </tr>
				        <c:forEach items="${drivings}" var="drivings">
					        <tr style="margin-top: 45px" class="jx">
					        	<td><input type="checkbox" name="jx" value="${drivings.fid}"></td>
					        	<td>${drivings.fnameL2}</td>
					        	<td>${drivings.fnumber}</td>
					        	<td>${drivings.fsimplename}</td>
					        	<td>${drivings.fdescriptionL2}</td>
					        	<td>${drivings.fcreatetime}</td>
					        	<td>${drivings.createName}</td>
					        	<td>${drivings.flastupdatetime}</td>
					        	<td>${drivings.updateName}</td>
					        	<td>${drivings.companyName}</td>
					       </tr>
				        </c:forEach>
				        </table>
				      </form>
				</div>
				      <button class="subtn" style="width: 200px;position: absolute;bottom: 25px;font-size: 16px;left: 170px" > 
				      	确定
				      </button>
				      <button class="btn" style="width: 200px;position: absolute;bottom: 25px;font-size: 16px;right: 170px" > 
				      	关闭
				      </button>
			</div>
		<c:if test="${empty trainingCharge}">
		
		<div class="weizhi">
			财务管理>>自带车训练收费>>新增
		</div>
		</c:if>
		<c:if test="${not empty trainingCharge}">
		<c:if test="${trainingCharge.cfbillstate != '5' }">
		<div class="weizhi">
			财务管理>>自带车训练收费>>修改
		</div>
		</c:if>
		</c:if>
		<c:if test="${trainingCharge.cfbillstate == '5' }">
		<div class="weizhi">
			财务管理>>自带车训练收费>>查看
		</div>
		</c:if>
	<div class="div_body" style="box-shadow: 0 0 5px #cccccc;height: 950px">
		<div id="content_id" style="display: none">
			<h2 style="text-align: center;">自带车训练收费</h2>
			<div>
				<table width="100%">
					<tr>
						<td>
							<span>车牌号</span>
							<span style="font-size: 27px;">${trainingChargeEntrys[0].cfcar}</span>
						</td>
						<td style="margin-left: 170px">
							<span style="text-align: center;">通行证号</span>
						</td>
						<td style="text-align: center">
							<span>单号</span><span>${trainingCharge.fnumber}</span>
						</td>
					</tr>
				</table>
			</div>
			<table width="100%" border="1" cellspacing="0" cellpadding="0" style="border: 1px solid #151515">
				<tr align="center">
					<td colspan="5" style="padding: 5px 0 ">训练车型</td>
					<td>时长</td>
					<td>返点</td>
					<td>单价</td>
					<td>金额</td>
					<td colspan="2">备注</td>
				</tr>
				<tr align="center">
					<td colspan="5" style="padding: 5px 0 ">伊兰特（）  普桑自带车（） 标志 ()</td>
					<td>${trainingChargeEntrys[0].cftime}</td>
					<td>${trainingChargeEntrys[0].cffandian}</td>
					<td>${trainingChargeEntrys[0].cfprice}</td>
					<td>${trainingChargeEntrys[0].cfprice * (trainingChargeEntrys[0].cftime + trainingChargeEntrys[0].cffandian)}</td>
					<td colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
				</tr>
			</table>
			<div style="margin: 10px 0 ">

				<span style="padding-right: 2%;">金额合计</span>
				<span style="padding-right: 1%;">${trainingChargeEntrys[0].cfprice * (trainingChargeEntrys[0].cftime + trainingChargeEntrys[0].cffandian)}</span>
				<span style="padding-right: 8%;">元</span>
				<span style="padding-right: 2%;">操作员：</span>
				<span style="padding-right: 5%;">${trainingCharge.createName}</span>
				<span style="padding-right: 4%;">审核：</span>
				<span style="padding-right: 4%;">经手人：</span>
				<span style="padding-right: 4%;">业务日期：<span>${trainingCharge.fbizdate}</span></span>
			</div>
			<table width="100%"  border="1" cellspacing="0" cellpadding="0" style="border: 1px solid #151515">
				<tr align="center">
					<td>

					</td>
					<td colspan="3" style="padding: 5px 0 ">
						<span>进场时间</span>
					</td>
					<td style="min-width: 80px;">
						<span>签字</span>
					</td>
					<td colspan="3">
						<span>出场时间</span>
					</td>
					<td style="min-width: 80px;">
						<span>签字</span>
					</td>
					<td rowspan="2">
						<span>安全状况</span>
					</td>
					<td rowspan="2" style="min-width: 80px;">
						<span>签字</span>
					</td>
				</tr>
				<tr align="center">
					<td style="padding: 10px 0 ">
						<span>大门保安</span>
					</td>
					<td colspan="3">
						<span>______年____月____日____：____</span>
					</td>
					<td>
						<span></span>
					</td>
					<td colspan="3">
						<span>______年____月____日____：____</span>
					</td>
					<td>
						<span></span>
					</td>
				</tr>
				<tr align="center">
					<td style="padding: 10px 0 ">
						<span>场训</span>
					</td>
					<td colspan="3">
						<span>______年____月____日____：____</span>
					</td>
					<td>
						<span></span>
					</td>
					<td colspan="3">
						<span>______年____月____日____：____</span>
					</td>
					<td>
						<span></span>
					</td>
					<td>
						<span></span>
					</td>
					<td>
						<span></span>
					</td>
				</tr>
			</table>

			<div style="margin: 10px 0 ">
				<span style="padding-right: 10%;">押金金额（大写）</span>
				<span  style="padding-right: 5%;">元</span>
				<span style="padding-right: 20%;">（小写）￥</span>
				<span style="padding-right: 10%;">收费签字</span>
				<span>退款签字</span>
			</div>
			<span ><span style="font-weight: bold">联系人：</span> &nbsp;&nbsp;&nbsp;18007002685（高传勇）</span>
			<table id="tbyd_content_id">
				<tr>
					<td width="90px">
						<span class="ty">特别约定：</span>
					</td>
					<td>
						<span class="jiacu">
							考场只负责提供训练场地，进场训练学员不得离开训练车辆，教练必须随车施教，不得超载，施画标记（违者罚款500元）。训练中发生事故、纠纷自行负责。此外，若考场所有方因此涉及诉讼、仲裁等形式的纠纷，教练员及学员除承担全部责任外，还应当赔偿考场所有方因此支付的律师费、误工费、交通费等一切相关的经济损失。
						</span>
					</td>
				</tr>
			</table>
			<span class="jiacu">教练员同意上述约定签字：</span>
		</div>
			<div class="div_form">
			<!----------------------------- 新增 --------------------------------->
			<c:if test="${empty trainingCharge}">
				<form action="<%=path%>/DrivingSys/editTrainingCharge" class="form">
						<div class="div_input_hang">
							<div class="input_hang">
								<span class="gn_name">驾校&nbsp;:&nbsp;</span>
								<input  type="text" name="name"  value="${department.fnameL2}" readonly="readonly" style="color: gray;"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">单据编号&nbsp;:&nbsp;</span>
								<input  type="text" name="fnumber" value="${fnumber}" style="color: gray;" readonly="readonly"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">业务日期&nbsp;:&nbsp;</span>
								<input  type="text" name="fbizdate"  id="ywrq" value="${time}" 
								onclick="WdatePicker({el:'ywrq',dateFmt:'yyyy-MM-dd'})"/>
								<img onclick="WdatePicker({el:'ywrq',dateFmt:'yyyy-MM-dd'})" 
					            src="<%=path%>/image/date.jpg"  align="absmiddle" style="padding-left: 15px">
							</div>
						</div>
						<div class="div_input_hang">
							<div class="input_hang">
								<span class="gn_name">备注&nbsp;:&nbsp;</span>
								<input name="fdescription"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">单据状态&nbsp;:&nbsp;</span>
								<select name="cfbillstate" disabled="disabled">
									<option style="color: gray;">新增</option>
								</select>
							</div>
							<div class="input_hang">
								<span class="gn_name">打印次数&nbsp;:&nbsp;</span>
								<input name="cfdycs" value="0" style="color: gray;" readonly="readonly"/>
							</div> 
					</div>
					
					<div class="div_zilei">
							<div style="width: 93%;text-align: right;">
								<img src="<%=path%>/image/insert2323.jpg" class="addTable">
								<span style="padding-right: 20px;color: #57a0ff;font-weight: 700;font-size: 14px" class="addTable">添加</span>
								<img src="<%=path%>/image/delete212.png" class="deleteTable">
								<span class="deleteTable" style="color: #57a0ff;font-weight: 700;font-size: 14px" class="deleteTable">删除</span>

							</div>
					</div>
					<input type="hidden" class="stu">
					<div style="min-height: 500px;width: 88%;padding-left: 90px;position: relative;">
					<div style="overflow:scroll;height: 500px;width: 100%"> 
							<table  width="100%" align="center" id="table1" style="min-height:50px;border-spacing:0;">
									<tr class="tr">
										<td  width="20px"></td>
										<td  width="30px"></td>
										<td align="center">车牌</td>
										<td align="center">车型</td>
										<td align="center">协议驾校</td>
										<td align="center">时长</td>
										<td align="center">返点</td>
										<td align="center">总时长</td>
										<td align="center">单价</td>
										<td align="center">金额</td>
										<td align="center">人数</td>
										<td align="center">备注</td>
									</tr>
							</table>
								
							<table align="center" id="table2" style="height:50px;overflow:scroll;border-spacing:0;display: none;margin-top: 100px;ma">
								<tr>
										<td rowspan="2"><input type="text" readonly="readonly" value="合计" class="fseq" style="width: 50px"></td>
										<td><input type="text" readonly="readonly"></td>
										<td><input type="text" readonly="readonly"></td>
										<td><input type="text" readonly="readonly"></td>
										<td><input type="text" readonly="readonly" value="0" id="sc"><input type="hidden" value="0"></td>
										<td><input type="text" value="0" readonly="readonly" id="fd"><input type="hidden" value="0"></td>
										<td><input type="text" readonly="readonly" value="0" id="zsc"><input type="hidden" value="0"></td>
										<td><input type="text" readonly="readonly"></td>
										<td><input type="text" readonly="readonly" value="0" id="je"><input type="hidden" value="0"></td>
										<td><input type="text" readonly="readonly" value="0" id="rs"><input type="hidden" value="0"></td>
										<td><input type="text" readonly="readonly"></td>
								</tr>
							</table>
						</div>
					</div>
					
					
					 <div class="div_input_hang" style="margin-top: 50px">
							<div class="input_hang">
								<span class="gn_name">审核人&nbsp;:&nbsp;</span>
								<input name="fhandlerid" readonly="readonly" style="color: gray;" type="text"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">创建者&nbsp;:&nbsp;</span>
								<input name="fcreatorid2" readonly="readonly" value="${name}" style="color: gray;" type="text"/>
								<input name="fcreatorid" readonly="readonly"  style="color: gray;" type="hidden"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">创建时间&nbsp;:&nbsp;</span>
								<input name="fcreatetime" style="color: gray;"readonly="readonly" type="text"/>
							</div> 
					</div>

					<div class="div_tj" style="padding-top: 0px;margin-left: 140px;margin-top: 20px">
						<div>
							<input class="input_submit bc" onclick="return verify()" value="" type="submit" style="margin-top: 0px;margin-right: 30px;"/>
						</div>
						<div>
							<input type="button" class="input_back fh" value="" onclick="back()" style="margin-top: 0px;"/>
						</div>
					</div>
				</form>
				</c:if>
				
			<!----------------------------- 修改 --------------------------------->
			<c:if test="${not empty trainingCharge}">
			<c:if test="${trainingCharge.cfbillstate != '5' }">
				<form action="<%=path%>/DrivingSys/editTrainingCharge" class="form">
						<div class="div_input_hang">
							<div class="input_hang">
								<span class="gn_name">驾校&nbsp;:&nbsp;</span>
								<input  type="text" name="name"  value="${trainingCharge.companyName}" readonly="readonly" style="color: gray;"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">单据编号&nbsp;:&nbsp;</span>
								<input  type="text" name="fnumber" value="${trainingCharge.fnumber}" style="color: gray;" readonly="readonly"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">业务日期&nbsp;:&nbsp;</span>
								<input  type="text" name="fbizdate"  id="ywrq" value="${trainingCharge.fbizdate}" 
								onclick="WdatePicker({el:'ywrq',dateFmt:'yyyy-MM-dd'})"/>
								<img onclick="WdatePicker({el:'ywrq',dateFmt:'yyyy-MM-dd'})" 
					            src="<%=path%>/image/date.jpg"  align="absmiddle" style="padding-left: 15px">
							</div>
						</div>
						<div class="div_input_hang">
							<div class="input_hang">
								<span class="gn_name">备注&nbsp;:&nbsp;</span>
								<input name="fdescription" value="${trainingCharge.fdescription}"/>
								<input type="hidden" name="fid" value="${trainingCharge.fid}" id="fid">
							</div>
							<div class="input_hang">
								<span class="gn_name">单据状态&nbsp;:&nbsp;</span>
								<select name="cfbillstate" disabled="disabled">
									<option style="color: gray;">保存</option>
								</select>
							</div>
							<div class="input_hang">
								<span class="gn_name">打印次数&nbsp;:&nbsp;</span>
								<input name="cfdycs"  style="color: gray;" readonly="readonly" value="${trainingCharge.cfdycs}"/>
							</div> 
					</div>
					
					<div class="div_zilei">
							<div style="width: 93%;text-align: right;">
								<img src="<%=path%>/image/insert2323.jpg" class="addTable">
								<span style="padding-right: 20px;color: #57a0ff;font-weight: 700;font-size: 14px" class="addTable">添加</span>
								<img src="<%=path%>/image/delete212.png" class="deleteTable">
								<span class="deleteTable" style="color: #57a0ff;font-weight: 700;font-size: 14px" class="deleteTable">删除</span>
								<span style="margin-left:20px; cursor:pointer; padding-right: 80px;color: #57a0ff;font-weight: 700;font-size: 14px"
									  class="printTable" onclick="print_func()">打印</span>
							</div>
					</div>
					<input type="hidden" class="stu">
					<div style="min-height: 500px;width: 88%;padding-left: 90px;position: relative;">
					<div style="overflow:scroll;height: 500px;width: 100%"> 
							<table  width="100%" align="center" id="table1" style="min-height:50px;border-spacing:0;">
									<tr class="tr">
										<td  width="20px"></td>
										<td  width="30px"></td>
										<td align="center">车牌</td>
										<td align="center">车型</td>
										<td align="center">协议驾校</td>
										<td align="center">时长</td>
										<td align="center">返点</td>
										<td align="center">总时长</td>
										<td align="center">单价</td>
										<td align="center">金额</td>
										<td align="center">人数</td>
										<td align="center">备注</td>
									</tr>
									<c:forEach items="${trainingChargeEntrys}" var="trainingChargeEntrys">
									<tr style="margin-top: 45px" class="jx${trainingChargeEntrys.fseq}">
										<td width="20px"><input type="checkbox" name="check" style="width: 15px"></td>
										<td>
											<input type="text" readonly="readonly" class="fseq2" value='${trainingChargeEntrys.fseq}' class="fseq2" style="width: 40px">
											<input type="hidden" name="fseq" class="fseq" value='${trainingChargeEntrys.fseq}'>
										</td>
										<td><input type="text" name="cfcar" class="cfcar" onblur="selTrain(this)" value="${trainingChargeEntrys.cfcar}"></td>
										<td><input type="text" name="cfcartype" class="cfcartype" value="${trainingChargeEntrys.cfcartype}"></td>
										<td>
											<input type="text" name="drivingName" class="drivingName" onclick = "kq($(this))" value="${trainingChargeEntrys.drivingName}">
											<input type="hidden" name="cfjiaxiaoid" value="${trainingChargeEntrys.cfjiaxiaoid}">
										</td>
										<td>
											<input type="text" name="cftime" class="cftime" onblur="cftime2($(this))" value="${trainingChargeEntrys.cftime}">
											<input type="hidden" value="${trainingChargeEntrys.cftime}">
										</td>
										<td>
											<input type="text" name="cffandian" class="cffandian" onblur="cffandian2($(this))" value="${trainingChargeEntrys.cffandian}">
											<input type="hidden" value="${trainingChargeEntrys.cffandian}">
										</td>
										<td>
											<input type="text" name="cfzsc" class="cfzsc" onblur="cfzsc2($(this))" value="${trainingChargeEntrys.cfzsc}">
											<input type="hidden" value="${trainingChargeEntrys.cffandian}">
										</td>
										<td>
											<input type="text" name="cfprice" class="cfprice" onblur="cfprice2($(this))" value="${trainingChargeEntrys.cfprice}">
										</td>
										<td>
											<input type="text" name="cfamount" class="cfamount" onblur="cfamount2($(this))" value="${trainingChargeEntrys.cfamount}"> 
											<input type="hidden" value="${trainingChargeEntrys.cfamount}">
										</td>
										<td>	
											<input type="text" name="cfnumber" class="cfnumber"  onblur="cfnumber2($(this))" value="${trainingChargeEntrys.cfnumber}">
											<input type="hidden" value="${trainingChargeEntrys.cfnumber}">
										</td>
										<td>
											<input type="text" name="cfremark" class="cfremark" value="${trainingChargeEntrys.cfremark}">
										</td>
									</tr>
									</c:forEach>
							</table>
								
							<table align="center" id="table2" style="height:50px;overflow:scroll;border-spacing:0;margin-top: 100px;">
								<tr>
										<td rowspan="2"><input type="text" readonly="readonly" value="合计" class="fseq" style="width: 50px"></td>
										<td><input type="text" readonly="readonly"></td>
										<td><input type="text" readonly="readonly"></td>
										<td><input type="text" readonly="readonly"></td>
										<td><input type="text" readonly="readonly" value="0" id="sc"></td>
										<td><input type="text" value="0" readonly="readonly" id="fd"></td>
										<td><input type="text" readonly="readonly" value="0" id="zsc"></td>
										<td><input type="text" readonly="readonly"></td>
										<td><input type="text" readonly="readonly" value="0" id="je"></td>
										<td><input type="text" readonly="readonly" value="0" id="rs"></td>
										<td><input type="text" readonly="readonly"></td>
								</tr>
							</table>
						</div>
					</div>
					
					
					 <div class="div_input_hang" style="margin-top: 50px">
							<div class="input_hang">
								<span class="gn_name">审核人&nbsp;:&nbsp;</span>
								<input readonly="readonly" style="color: gray;" type="text" value="${trainingCharge.auditName}"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">创建者&nbsp;:&nbsp;</span>
								<input readonly="readonly" style="color: gray;" type="text" value="${trainingCharge.createName}"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">创建时间&nbsp;:&nbsp;</span>
								<input name="fcreatetime" style="color: gray;"readonly="readonly" type="text" value="${trainingCharge.fcreatetime}"/>
							</div> 
					</div> 
					
					<div class="div_tj" style="padding-top: 0px">
						<div>
							<input class="input_submit bc" value="" type="submit">
						</div>
						<shiro:hasPermission name="/auditOwnCarTrain">
						<div style="padding-right: 50px">
							<input type="button" class="input_submit sh"value="" id="sh">
							<input type="hidden" value="1">
						</div>
						</shiro:hasPermission>
						<div>
							<input type="button" class="input_submit fh"  value="返    回" onclick="back()"/>
						</div>
					</div>
				</form>
				</c:if>
				</c:if>
				
				<!----------------------------- 查看 --------------------------------->
				<c:if test="${trainingCharge.cfbillstate == '5' }">
				<form action="<%=path%>/DrivingSys/editTrainingCharge" class="form">
						<div class="div_input_hang">
							<div class="input_hang">
								<span class="gn_name">驾校&nbsp;:&nbsp;</span>
								<input  type="text" name="name"  value="${trainingCharge.companyName}" readonly="readonly" style="color: gray;"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">单据编号&nbsp;:&nbsp;</span>
								<input  type="text" name="fnumber" value="${trainingCharge.fnumber}" style="color: gray;" readonly="readonly"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">业务日期&nbsp;:&nbsp;</span>
								<input  type="text" name="fbizdate"  id="ywrq" value="${trainingCharge.fbizdate}" readonly="readonly"/>
								<img src="<%=path%>/image/date.jpg"   style="padding-left: 15px">
							</div>
						</div>
						<div class="div_input_hang">
							<div class="input_hang">
								<span class="gn_name">备注&nbsp;:&nbsp;</span>
								<input name="fdescription" value="${trainingCharge.fdescription}" readonly="readonly"/>
								<input type="hidden" name="fid" value="${trainingCharge.fid}" id="fid">
							</div>
							<div class="input_hang">
								<span class="gn_name">单据状态&nbsp;:&nbsp;</span>
								<select name="cfbillstate" disabled="disabled">
									<option style="color: gray;">审核</option>
								</select>
							</div>
							<div class="input_hang">
								<span class="gn_name">打印次数&nbsp;:&nbsp;</span>
								<input name="cfdycs"  style="color: gray;" readonly="readonly" value="${trainingCharge.cfdycs}"/>
							</div> 
					</div>
					
					<div class="div_zilei">
						<div style="width: 88%;text-align: right;">
						<%--<img src="<%=path%>/image/insert2323.jpg">
								<span style="padding-right: 20px;color: #a9bbe0;font-size: 14px">添加</span>
								<img src="<%=path%>/image/delete212.png">
								<span class="deleteTable" style="color: #a9bbe0;font-size: 14px">删除</span>--%>
							<span style="margin-left:20px; cursor:pointer; padding-right: 80px;color: #57a0ff;font-weight: 700;font-size: 14px"
								  class="printTable" onclick="print_func()">打印</span>
							</div>
					</div>
					<input type="hidden" class="stu">
					<div style="min-height: 500px;width: 88%;padding-left: 90px;position: relative;">
					<div style="overflow:scroll;height: 500px;width: 100%"> 
							<table  width="100%" align="center" id="table1" style="min-height:50px;border-spacing:0;">
									<tr class="tr">
										<td  width="20px"></td>
										<td  width="30px"></td>
										<td align="center">车牌</td>
										<td align="center">车型</td>
										<td align="center">协议驾校</td>
										<td align="center">时长</td>
										<td align="center">返点</td>
										<td align="center">总时长</td>
										<td align="center">单价</td>
										<td align="center">金额</td>
										<td align="center">人数</td>
										<td align="center">备注</td>
									</tr>
									<c:forEach items="${trainingChargeEntrys}" var="trainingChargeEntrys">
									<tr style="margin-top: 45px" class="jx${trainingChargeEntrys.fseq}">
										<td width="20px"><input type="checkbox" name="check" style="width: 15px" disabled="disabled"></td>
										<td>
											<input type="text" readonly="readonly" class="fseq2" value='${trainingChargeEntrys.fseq}' class="fseq2" style="width: 40px" readonly="readonly">
											<input type="hidden" name="fseq" class="fseq" value='${trainingChargeEntrys.fseq}'>
										</td>
										<td><input type="text" name="cfcar" class="cfcar" value="${trainingChargeEntrys.cfcar}" readonly="readonly"></td>
										<td><input type="text" name="cfcartype" class="cfcartype" value="${trainingChargeEntrys.cfcartype}" readonly="readonly"></td>
										<td>
											<input type="text" name="drivingName" class="drivingName" value="${trainingChargeEntrys.drivingName}" readonly="readonly">
											<input type="hidden" name="cfjiaxiaoid" value="${trainingChargeEntrys.cfjiaxiaoid}">
										</td>
										<td>
											<input type="text" name="cftime" class="cftime" readonly="readonly" value="${trainingChargeEntrys.cftime}">
											<input type="hidden" value="${trainingChargeEntrys.cftime}">
										</td>
										<td>
											<input type="text" name="cffandian" class="cffandian" readonly="readonly" value="${trainingChargeEntrys.cffandian}">
											<input type="hidden" value="${trainingChargeEntrys.cffandian}">
										</td>
										<td>
											<input type="text" name="cfzsc" class="cfzsc" readonly="readonly" value="${trainingChargeEntrys.cfzsc}">
											<input type="hidden" value="${trainingChargeEntrys.cffandian}">
										</td>
										<td>
											<input type="text" name="cfprice" class="cfprice" readonly="readonly" value="${trainingChargeEntrys.cfprice}">
										</td>
										<td>
											<input type="text" name="cfamount" class="cfamount" readonly="readonly" value="${trainingChargeEntrys.cfamount}"> 
											<input type="hidden" value="${trainingChargeEntrys.cfamount}">
										</td>
										<td>	
											<input type="text" name="cfnumber" class="cfnumber" value="0" readonly="readonly" value="${trainingChargeEntrys.cfnumber}">						
											<input type="hidden" value="${trainingChargeEntrys.cfnumber}">
										</td>
										<td>
											<input type="text" name="cfremark" class="cfremark" value="${trainingChargeEntrys.cfremark}" readonly="readonly">
										</td>
									</tr>
									</c:forEach>
							</table>
								
							<table align="center" id="table2" style="height:50px;overflow:scroll;border-spacing:0;margin-top: 100px;">
								<tr>
										<td rowspan="2"><input type="text" readonly="readonly" value="合计" class="fseq" style="width: 50px"></td>
										<td><input type="text" readonly="readonly"></td>
										<td><input type="text" readonly="readonly"></td>
										<td><input type="text" readonly="readonly"></td>
										<td><input type="text" readonly="readonly" value="0" id="sc"></td>
										<td><input type="text" value="0" readonly="readonly" id="fd"></td>
										<td><input type="text" readonly="readonly" value="0" id="zsc"></td>
										<td><input type="text" readonly="readonly"></td>
										<td><input type="text" readonly="readonly" value="0" id="je"></td>
										<td><input type="text" readonly="readonly" value="0" id="rs"></td>
										<td><input type="text" readonly="readonly"></td>
								</tr>
							</table>
						</div>
					</div>
					
					
					 <div class="div_input_hang" style="margin-top: 50px">
							<div class="input_hang">
								<span class="gn_name">审核人&nbsp;:&nbsp;</span>
								<input name="fhandlerid" readonly="readonly" style="color: gray;" type="text" value="${trainingCharge.auditName}"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">创建者&nbsp;:&nbsp;</span>
								<input name="fcreatorid2" readonly="readonly" style="color: gray;" type="text" value="${trainingCharge.createName}"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">创建时间&nbsp;:&nbsp;</span>
								<input name="fcreatetime" style="color: gray;"readonly="readonly" type="text" value="${trainingCharge.fcreatetime}"/>
							</div> 
					</div> 
					
					<div class="div_tj" style="padding-top: 0px">
						<shiro:hasPermission name="/againstAuditOwnCarTrain">
						<div>
							<input type="button" class="input_submit fsh" value="" id="sh">
							<input type="hidden" value="2">
						</div>
						</shiro:hasPermission>
						<div>
							<input type="button" class="input_submit fh" value="" onclick="back()"/>
						</div>
					</div>
				</form>
				</c:if>
		</div>
	</div>
</div>
</body>
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<script type="text/javascript" src="<%=path%>/common/print/jQuery.print.min.js"></script>
<%@ include file="/WEB-INF/JSP/ajax.jsp" %>
<script type="text/javascript" src="<%=path%>/HoganJS/handlebars-v4.0.11.js"></script>
<script type="text/javascript">

$(document).ready(function(){
	var type = "${type}"
	if(type == null || type == ''){
		
	}else{
		editAlert();
	}
})

//删除一行
$(".deleteTable").click(function(){
	var tr_len = $("#table1 tr").length;
	if(tr_len == 1){
		
	}else{
			var s = '';
			$('input:checkbox[name=check]').each(function(i) {
				
				if($(this).is(':checked')){
					//减去时长
					var cftime = $(this).parent().parent().find(".cftime").val()
					if(cftime == '' || cftime == null){
						
					}else{
					var sc = ($("#sc").val()*1)-(cftime*1)
						//保留2位小数点
					 	sc = decimal(sc,2);
						$("#sc").val(sc)
					}
					//减去返点
					var cffandian = $(this).parent().parent().find(".cffandian").val()
					if(cffandian == '' || cffandian == null){
						
					}else{
						var fd = ($("#fd").val()*1)-(cffandian*1)
						//保留2位小数点
					 	fd = decimal(fd,2);
						$("#fd").val(fd)
					}
					
					//减去总实长
					var cfzsc = $(this).parent().parent().find(".cfzsc").val()
					if(cfzsc == '' || cfzsc == null){
						
					}else{
						var zsc = ($("#zsc").val()*1)-(cfzsc*1);
						//保留2位小数点
					 	zsc = decimal(zsc,2);
						$("#zsc").val(zsc)
					}
					
					//减去金额
					var cfamount = $(this).parent().parent().find(".cfamount").val()
					if(cfamount == '' || cfamount == null){
						
					}else{
						var je = ($("#je").val()*1)-(cfamount*1);
						//保留2位小数点
					 	je = decimal(je,2);
						$("#je").val(je)
					}
					
					//减去人数
					var cfnumber = $(this).parent().parent().find(".cfnumber").val()
					if(cfnumber == '' || cfnumber == null){
						
					}else{
						var rs = ($("#rs").val()*1)-(cfnumber*1);
						//保留2位小数点
					 	rs = decimal(rs,2);
						$("#rs").val(rs)
					}
					if($("#table1 tr").length == 2){
						$("#table2").css('display','none')
					}
					$(this).parent().parent().remove();
					s = '1';
				}
			})
			
			
			//判断是否选中
			if(s == null || s == ''){
				alert("请选择一条数据删除");
				return false;
			}
			//重新排序
			$('#table1 tr td .fseq').each(function(i) {
				var s = i*1 + 1*1;
				$(this).val(s);
				$(this).prev().val(s)
				$(this).parent().parent().attr("class",'xy'+s);
				$(this).parent().parent().find(".cffpsj").attr("id",'xy'+s);
			})
	}
})
//返回
function back(){
    parent.closeSelectCard()

//    location = '<%=path%>/DrivingSys/queryTrainingCharge/look.action';
}

//开启弹框
 function kq(_this){
	var jx = _this.parent().parent().prop("class");
	$(".stu").val(jx)
	$('#modal-overlay').css('visibility','visible')
	$('.modal-data').css('visibility','visible')
	$('input:checkbox').removeAttr('checked');
}

//添加一行
$('.addTable').click(function(){
	 var tr_len = $("#table1 tr").length;
	 var str = ""
	 str+='<tr style="margin-top: 45px" class=jx'+tr_len+'>'
	 str+='<td width="20px"><input type="checkbox" name="check" style="width: 15px"></td>'
	 str+='<td><input type="text" readonly="readonly" class="fseq2" value='+tr_len+' style="width: 40px"><input type="hidden" name="fseq" class="fseq" value='+tr_len+'></td>'
	 str+='<td><input type="text" name="cfcar" onblur="selTrain(this)" class="cfcar"></td>'
	 str+='<td><input type="text" name="cfcartype" class="cfcartype"></td>'
	 str+='<td><input type="text" name="drivingName" class="drivingName" onclick = "kq($(this))"><input type="hidden" name="cfjiaxiaoid"></td>'
	 str+='<td><input type="text" name="cftime" class="cftime" onblur="cftime2($(this))"><input type="hidden" value="0"></td>'
	 str+='<td><input type="text" name="cffandian" class="cffandian" onblur="cffandian2($(this))"><input type="hidden" value="0"></td>'
     str+='<td><input type="text" name="cfzsc" class="cfzsc" onblur="cfzsc2($(this))"><input type="hidden" value="0"></td>'
     str+='<td><input type="text" name="cfprice" class="cfprice" onblur="cfprice2($(this))"></td>'
     str+='<td><input type="text" name="cfamount" class="cfamount" onblur="cfamount2($(this))"><input type="hidden" value="0">'
     str+='<td><input type="text" name="cfnumber" class="cfnumber" value="0" onblur="cfnumber2($(this))"><input type="hidden" value="0"></td>'
     str+='<td><input type="text" name="cfremark" class="cfremark"></td>'
	 $("#table1").append(str)
	 $("#table2").show()
})

 $(".cftime,.cffandian,.cfzsc,.cfprice,.cfamount").live('keyup', function(event) {
	 	var cfremark = $(this).prop("class");
	 	if(cfremark == 'cfremark'){
	 		
	 	}else{
	 		//最后一位是小数点的话，移除
	 		var $amountInput = $(this);
	 		//响应鼠标事件，允许左右方向键移动 
	 		event = window.event || event;
	 		if(event.keyCode == 37 | event.keyCode == 39) {
	 			return;
	 		}
	 		var clazz = $(this).prop("class")
	 		//获取输入框的值
	 		var value = $('.'+clazz+'').val();
	 		//判断负数是否在第一位
	 		 if(value.substring(0,1) == '-'){
	 			
	 		 }
	 		//判断负数不是在第一位，替换
	 		 if(value.lastIndexOf('-') > 0){
	 			 $('.'+clazz+'').val("")
	 			// $amountInput.val($amountInput.val().replace('-','')
	 		 }
	 		//先把非数字的都替换掉，除了数字和. 
	 		$amountInput.val($amountInput.val().replace(/[^\-?\d.]/g, "").
	 		//只允许一个小数点              
	 		replace(/^\./g, "").replace(/\.{2,}/g, ".").
	 		//只能输入小数点后两位
	 		replace(".", "$#$").replace(/\./g, "").replace("$#$", ".").replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'));
	 	}
});
//当键盘按下之后立即校验，并替换当前操作框中的内容 
$(".cfnumber").live('keyup', function(event){
	if($(this).val() == '0'){
		
	}else{
		$(this).val($(this).val().replace(/\D|^0/g,'')); 
	}
});

/* 关闭弹出框    */
$('.btn').click(function(){
	$('#modal-overlay').css('visibility','hidden')
	$('.modal-data').css('visibility','hidden')
	$('input:checkbox').removeAttr('checked');
})

//根据条件查询驾校
$(".findBtn").click(function(){
	var name = $(".name").val();
	$.ajax({
		 url: '<%=path%>/DrivingSys/queryDrivingByName',
		 type: "post",
         async: true,
         data: {'name': name},
         dataType: "json",
         success:function(json){
        	 var str = ''
        	 for(var i = 0;i < json.length;i++){
        		 str+='<tr style="margin-top: 45px" class="jx">'
        		 str+='<td><input type="checkbox" name="jx" value='+json[i].fid+'></td>'
        		 str+='<td>'+json[i].fnameL2+'</td>'
        		 if(json[i].fnumber == null){
        			 str+='<td></td>'
        		 }else{
        			 str+='<td>'+json[i].fnumber+'</td>'
        		 }
        		 if(json[i].fsimplename == null){
        			 str+='<td></td>'
        		 }else{
        			 str+='<td>'+json[i].fsimplename+'</td>'
        		 }
        		 if(json[i].fdescriptionL2 == null){
        			 str+='<td></td>'
        		 }else{
        			 str+='<td>'+json[i].fdescriptionL2+'</td>'
        		 }
        		 if(json[i].fcreatetime == null){
        			 str+='<td></td>'
        		 }else{
        			 str+='<td>'+json[i].fcreatetime+'</td>'
        		 }
        		 if(json[i].createName == null){
        			 str+='<td></td>'
        		 }else{
        			 str+='<td>'+json[i].createName+'</td>'
        		 }
        		 if(json[i].flastupdatetime == null){
        			 str+='<td></td>'
        		 }else{
        			 str+='<td>'+json[i].flastupdatetime+'</td>'
        		 }
        		 if(json[i].updateName == null){
        			 str+='<td></td>'
        		 }else{
        			 str+='<td>'+json[i].updateName+'</td>'
        		 }
        		 if(json[i].companyName == null){
        			 str+='<td></td>'
        		 }else{
        			 str+='<td>'+json[i].companyName+'</td>'
        		 }
		         str+='</tr>'
        	 }
        	 $(".jx").remove();
	         $('.head2').append(str) 
         },
         error: function(){alert('Error');} 
	})
	
})
 
     //单击选中
     $(".jx td").live('click',function(){
    	$('input:checkbox[name=jx]:checked').each(function(i) {
    		$(this).removeAttr("checked");
     	});
        $(this).parent().find("input:checkbox").attr('checked','checked');
    })  

//选择数据
 $('.subtn').click(function () {
	    var fseq = $(".stu").val();
	 	var fid;
	 	var name;
		$('input:checkbox[name=jx]:checked').each(function(i) {
	        if (0 == i) {
	             //把学生id增加到字表中
	             fid = $(this).val();
	             name = $(this).parent().next().text();
	             $('.'+fseq+'').find(".drivingName").val(name)
	             $('.'+fseq+'').find(".drivingName").next().val(fid)
	         }
	         
     	});
		 if(fid == null || fid == ''){
	        	alert("请选择一条数据")
	        	return false
	     }
		 $('#modal-overlay').css('visibility','hidden')
		 $('.modal-data').css('visibility','hidden')
 });
 
 //双击确定
   $(document).on('dblclick','.jx td',function(){
	    var fseq = $(".stu").val();
	 	var fid;
	 	var name;
	    //把学生id增加到字表中
	    fid = $(this).parent().find("input:checkbox").val();
	    name = $(this).parent().find("input:checkbox").parent().next().text();
	    $('.'+fseq+'').find(".drivingName").val(name)
	    $('.'+fseq+'').find(".drivingName").next().val(fid)
		$('#modal-overlay').css('visibility','hidden')
		$('.modal-data').css('visibility','hidden')
   })
 
 //时长计算
 function cftime2 (_this) {
		//避免最后一个字符串是.
	 	_this.val((_this.val().replace(/\.$/g, "")));
	 	if(_this.val() == '-'){
			_this.val("")
		}
		if(_this.val() == '-'){
			_this.val("")
		}
		 //当前值
		 var money = _this.val()
		 if(money == ''){
			 money = 0;
		 }
		 //存放之前的值
		 var zq =  _this.next().val();
		 _this.next().val(money);
		 //时长计算
		 var ssje = _this.parent().next().find(".cffandian").val();
		 if(ssje == '' || ssje == null){
			 ssje = 0;
		 }
		 //计算时长
		 var jine = (ssje*1)+(money*1);
		 //保留2位小数点
		 jine = decimal(jine,2);
		 _this.parent().next().next().find(".cfzsc").val(jine);
		 
		 
		 //计算金额
		 //单价
		 var jfje = _this.parent().next().next().next().find(".cfprice").val();
		 if(jfje == '' || jfje == null || jfje == 0){
			 _this.parent().next().next().next().next().find(".cfamount").val(0);
		 }
			 var jfje2 = (money*1) * (jfje*1)
			 //保留2位小数点
			 jfje2 = decimal(jfje2,2);
			 _this.parent().next().next().next().next().find(".cfamount").val(jfje2);
			 //alert(_this.parent().next().next().next().next().find("input:hidden").val())
			 var no = _this.parent().next().next().next().next().find("input:hidden").val();
		//计算总时长
		var ze = $("#sc").val();
		//计算总额
		var jine = (ze*1)-(zq*1)+(money*1);
		//保留2位小数点
		jine = decimal(jine,2);
		$("#sc").val(jine);
		
		//计算总总时长
		/*var ss = $("#zsc").val();
		 //计算实收总额
		var ssResult = (ss*1)-(zq*1)+(money*1);
		//保留2位小数点
		ssResult = decimal(ssResult,2); */
		var zsc = 0;
		 $(".cfzsc").each(function(){
			   var  sc = $(this).val()
			   if(sc == '' || sc == null){
				   sc = 0;
			   }
			   zsc = (sc*1) + (zsc*1)
		});
		 //保留2位小数点
		zsc = decimal(zsc,2);
		$("#zsc").val(zsc);
		
		 //计算总总金额
		var zje = 0;
		 $(".cfamount").each(function(){
			   var  sc = $(this).val()
			   if(sc == '' || sc == null){
				   sc = 0;
			   }
			   zje = (sc*1) + (zje*1)
		});
		 //保留2位小数点
		zje = decimal(zje,2);
		$("#je").val(zje); 
		_this.parent().next().next().next().next().find("input:hidden").val(jfje2);
 }
 
 //计算反点
 function cffandian2 (_this) {
	 	//避免最后一个字符串是.
	 	_this.val((_this.val().replace(/\.$/g, "")));
	 	if(_this.val() == '-'){
			_this.val("")
		}
		 //现金
		 var money = _this.val()
		 if(money == ''){
			 money = 0;
		 }
		 //存放之前的值
		 var zq =  _this.next().val();
		 _this.next().val(money);
		 
		 var ssje = _this.parent().next().find(".cfzsc").val();
		 if(ssje == '' || ssje == null){
			 ssje = 0;
		 }
		 
		 var jine = (ssje*1) - (zq*1) + (money*1);
		 //保留2位小数点
		 jine = decimal(jine,2);
		 _this.parent().next().find(".cfzsc").val(jine)
				 
		//返点总额
		var ze = $("#fd").val();
		//计算总额
		var jine = (ze*1)-(zq*1)+(money*1);
		//保留2位小数点
		jine = decimal(jine,2);
		$("#fd").val(jine);
		
		//计算总总时长
		var ss = $("#zsc").val();
		//计算实收总额
		var ssResult = (ss*1)-(zq*1)+(money*1);
		//保留2位小数点
		ssResult = decimal(ssResult,2);
		$("#zsc").val(ssResult);
		
 }
 
//计算总时长
 function cfzsc2 (_this) {
		//避免最后一个字符串是.
	 	_this.val((_this.val().replace(/\.$/g, "")));
	 	if(_this.val() == '-'){
			_this.val("")
		}
		 //现金
		 var money = _this.val()
		 if(money == ''){
			 money = 0;
		 }
		/*  //存放之前的值
		 var zq =  _this.next().val();
		 _this.next().val(money);
		//欠费总和实长
		var qfjezj = $("#zsc").val();
		//计算实收总额
		var ssResult = (qfjezj*1) - (zq*1) + (money*1);
		//保留2位小数点
		ssResult = decimal(ssResult,2); */
		var zsc = 0;
		 $(".cfzsc").each(function(){
			   var  sc = $(this).val()
			   if(sc == '' || sc == null){
				   sc = 0;
			   }
			   zsc = (sc*1) + (zsc*1)
		});
		$("#zsc").val(zsc);
 }
 
 
//单价计算
 function cfprice2 (_this) {
		//避免最后一个字符串是.
	 	_this.val((_this.val().replace(/\.$/g, "")));
	 	if(_this.val() == '-'){
			_this.val("")
		}
		 var money = _this.val()
		 if(money == ''){
			 money = 0;
		 }
		 //存放之前的值
		 var zq =  _this.next().val();
		 _this.next().val(money);
		 
		 var ssje = _this.parent().prev().prev().prev().find(".cftime").val();
		 if(ssje == 0 || ssje =='' || ssje == null){
			 ssje = 0;
		 }
		
		 var jine = (ssje*1) * (money*1);
		//保留2位小数点
		jine = decimal(jine,2);
		
		var je = _this.parent().next().find(".cfamount").val();
		 _this.parent().next().find(".cfamount").val(jine);
		 _this.parent().next().find("input:hidden").val(jine);
		 
		
		 var cfamount = 0;
		 $(".cfamount").each(function(){
			   var  money = $(this).val()
			   if(money == '' || money == null){
				   money = 0;
			   }
			   cfamount = (cfamount*1) + (money*1)
		});
		 $("#je").val(cfamount);
 } 
 
//计算金额
 function cfamount2 (_this) {
		//避免最后一个字符串是.
	 	_this.val((_this.val().replace(/\.$/g, "")));
	 	if(_this.val() == '-'){
			_this.val("")
		}
		 //现金
		 var money = _this.val()
		 if(money == ''){
			 money = 0;
		 }
		/*  //存放之前的值
		 var zq =  _this.next().val();
		 _this.next().val(money);
		//计算总总时长
		var ss = $("#je").val();
		//计算实收总额
		var ssResult = (ss*1)-(zq*1)+(money*1);
		//保留2位小数点
		ssResult = decimal(ssResult,2);
		$("#je").val(ssResult); */
		var cfamount = 0;
		 $(".cfamount").each(function(){
			   var  money = $(this).val()
			   if(money == '' || money == null){
				   money = 0;
			   }
			   cfamount = (cfamount*1) + (money*1)
		});
		 $("#je").val(cfamount);
 } 
 
//人数计算
 function cfnumber2 (_this) {
		//避免最后一个字符串是.
	 	_this.val((_this.val().replace(/\.$/g, "")));
	 	if(_this.val() == '-'){
			_this.val("")
		}
		 //现金
		 var money = _this.val()
		 if(money == ''){
			 money = 0;
		 }
		 //存放之前的值
		 var zq =  _this.next().val();
		 _this.next().val(money);
		//计算总总时长
		var ss = $("#rs").val();
		//计算实收总额
		var ssResult = (ss*1)-(zq*1)+(money*1);
		//保留2位小数点
		ssResult = decimal(ssResult,2);
		$("#rs").val(ssResult);
 } 
 
//num是要处理的数字  v为要保留的小数位数
function decimal(num,v){
	var vv = Math.pow(10,v);
	return Math.round(num*vv)/vv;
}
 
window.onload=function() {
	//计算时长
	var cftime = 0;
	$(".cftime").each(function(i){
		var s = $(this).val();
		if(s == null || s == ''){
			s = 0;
		}
		cftime = (cftime*1) + (s*1);
		cftime = decimal(cftime,2);
	})
	$("#sc").val(cftime)
	
	//计算返点
	var cffandian = 0;
	$(".cffandian").each(function(i){
		var s = $(this).val();
		if(s == null || s == ''){
			s = 0;
		}
		cffandian = (cffandian*1) + (s*1);
		cffandian = decimal(cffandian,2);
	})
	$("#fd").val(cffandian)
	
	//计算总时长
	var cfzsc = 0;
	$(".cfzsc").each(function(i){
		var s = $(this).val();
		if(s == null || s == ''){
			s = 0;
		}
		cfzsc = (cfzsc*1) + (s*1);
		cfzsc = decimal(cfzsc,2);
	})
	$("#zsc").val(cfzsc)
	
	//计算金额
	var cfamount = 0;
	$(".cfamount").each(function(i){
		var s = $(this).val();
		if(s == null || s == ''){
			s = 0;
		}
		cfamount = (cfamount*1) + (s*1);
		cfamount = decimal(cfamount,2);
	})
	$("#je").val(cfamount)
	
	//计算人数
	var cfnumber = 0;
	$(".cfnumber").each(function(i){
		var s = $(this).val();
		if(s == null || s == ''){
			s = 0;
		}
		cfnumber = (cfnumber*1) + (s*1);
		cfnumber = decimal(cfnumber,2);
	})
	$("#rs").val(cfnumber)
}

 //审核,反审核
 $("#sh").click(function(){
	 var fid = $("#fid").val();
	 var type = $(this).next().val();
	 $.ajax({
		 url: '<%=path%>/DrivingSys/auditTrainingCharge',
         type: "post",
         data: {'fid': fid,'type':type},
         dataType: "json",
         success:function(json){
        	 var url = '/queryTrainingChargeByFid?fid='+fid
        	if(type == '1'){
        		if(json == '1'){
                    showAlert('审核成功', url)
        		}else{
                    showAlert('审核成功', url)
            	}
        	}else{
        		if(json == '1'){
                    showAlert('反审核成功', url)
        		}else{
                    showAlert('反审核成功', url)
            	}
        	}
         },
         error: function(){alert('Error');} 
	 })
 })
//验证单据下是否有数据
function verify() {
    var s = 0;
    if($(".cfcar").val()==''){
        alert("请输入车牌")
		return false;
    }
    $("input[name='fseq']").each(function () {
        if ($(this).val() == '' || $(this).val() == null) {

        } else {
            s = 1;
            return false;
        }

    })
    var ywrq = $("#ywrq").val();
    if (ywrq == null || ywrq == '') {
        alert("业务日期不能为空");
        return false;
    }

    if (s == 0) {
        alert("请至少添加一条数据");
        return false;
    }
    /*$("input[type='submit']").attr("disabled", "disabled");*/

}

//防止表单重复提交
$('form').submit(function() {
    if(typeof jQuery.data(this, "disabledOnSubmit") == 'undefined') {
        jQuery.data(this, "disabledOnSubmit", { submited: true });
        $('input[type=submit], input[type=button]', this).each(function() {
            $(this).attr("disabled", "disabled");
        });
        return true;
    }
    else
    {
        return false;
    }
});

function selTrain(_this) {
    var $this = $(_this)
    $.ajax({
        url: '<%=path%>/DrivingSys/selTrainingChargeByCar',
        type: "post",
        data: {'car': $this.val()},
        dataType: "json",
        success:function(json){
        if(json == null){

        }else {
            $this.parent().next().find('input').val(json.cfcartype)
            $this.parent().next().next().find('input[name=drivingName]').val(json.drivingName)
            $this.parent().next().next().find('input[type=hidden]').val(json.cfjiaxiaoid)
        }
        },
        error: function(){alert('Error');}
    })
}

function Arabia_to_Chinese(Num) {
    if (Num == "0") {
        return "零元整";
    }
    for (i = Num.length - 1; i >= 0; i--) {
        Num = Num.replace(",", "")//替换tomoney()中的“,”
        Num = Num.replace(" ", "")//替换tomoney()中的空格
    }
    Num = Num.replace("￥", "")//替换掉可能出现的￥字符
    if (isNaN(Num)) { //验证输入的字符是否为数字
        //alert("请检查小写金额是否正确");
        return;
    }
    //---字符处理完毕，开始转换，转换采用前后两部分分别转换---//
    part = String(Num).split(".");
    newchar = "";
    //小数点前进行转化
    for (i = part[0].length - 1; i >= 0; i--) {
        if (part[0].length > 10) {
            alert("位数过大，无法计算");
            return "";
        } //若数量超过拾亿单位，提示
        tmpnewchar = ""
        perchar = part[0].charAt(i);
        switch (perchar) {
            case "0":
                tmpnewchar = "零" + tmpnewchar;
                break;
            case "1":
                tmpnewchar = "壹" + tmpnewchar;
                break;
            case "2":
                tmpnewchar = "贰" + tmpnewchar;
                break;
            case "3":
                tmpnewchar = "叁" + tmpnewchar;
                break;
            case "4":
                tmpnewchar = "肆" + tmpnewchar;
                break;
            case "5":
                tmpnewchar = "伍" + tmpnewchar;
                break;
            case "6":
                tmpnewchar = "陆" + tmpnewchar;
                break;
            case "7":
                tmpnewchar = "柒" + tmpnewchar;
                break;
            case "8":
                tmpnewchar = "捌" + tmpnewchar;
                break;
            case "9":
                tmpnewchar = "玖" + tmpnewchar;
                break;
        }
        switch (part[0].length - i - 1) {
            case 0:
                tmpnewchar = tmpnewchar + "元";
                break;
            case 1:
                if (perchar != 0) tmpnewchar = tmpnewchar + "拾";
                break;
            case 2:
                if (perchar != 0) tmpnewchar = tmpnewchar + "佰";
                break;
            case 3:
                if (perchar != 0) tmpnewchar = tmpnewchar + "仟";
                break;
            case 4:
                tmpnewchar = tmpnewchar + "万";
                break;
            case 5:
                if (perchar != 0) tmpnewchar = tmpnewchar + "拾";
                break;
            case 6:
                if (perchar != 0) tmpnewchar = tmpnewchar + "佰";
                break;
            case 7:
                if (perchar != 0) tmpnewchar = tmpnewchar + "仟";
                break;
            case 8:
                tmpnewchar = tmpnewchar + "亿";
                break;
            case 9:
                tmpnewchar = tmpnewchar + "拾";
                break;
        }
        newchar = tmpnewchar + newchar;
    }
    //小数点之后进行转化
    if (Num.indexOf(".") != -1) {
        if (part[1].length > 2) {
            alert("小数点之后只能保留两位,系统将自动截段");
            part[1] = part[1].substr(0, 2)
        }
        for (i = 0; i < part[1].length; i++) {
            tmpnewchar = ""
            perchar = part[1].charAt(i)
            switch (perchar) {
                case "0":
                    tmpnewchar = "零" + tmpnewchar;
                    break;
                case "1":
                    tmpnewchar = "壹" + tmpnewchar;
                    break;
                case "2":
                    tmpnewchar = "贰" + tmpnewchar;
                    break;
                case "3":
                    tmpnewchar = "叁" + tmpnewchar;
                    break;
                case "4":
                    tmpnewchar = "肆" + tmpnewchar;
                    break;
                case "5":
                    tmpnewchar = "伍" + tmpnewchar;
                    break;
                case "6":
                    tmpnewchar = "陆" + tmpnewchar;
                    break;
                case "7":
                    tmpnewchar = "柒" + tmpnewchar;
                    break;
                case "8":
                    tmpnewchar = "捌" + tmpnewchar;
                    break;
                case "9":
                    tmpnewchar = "玖" + tmpnewchar;
                    break;
            }
            if (i == 0) tmpnewchar = tmpnewchar + "角";
            if (i == 1) tmpnewchar = tmpnewchar + "分";
            newchar = newchar + tmpnewchar;
        }
    }
    //替换所有无用汉字
    while (newchar.search("零零") != -1)
        newchar = newchar.replace("零零", "零");
    newchar = newchar.replace("零亿", "亿");
    newchar = newchar.replace("亿万", "亿");
    newchar = newchar.replace("零万", "万");
    newchar = newchar.replace("零元", "元");
    newchar = newchar.replace("零角", "");
    newchar = newchar.replace("零分", "");

    if (newchar.charAt(newchar.length - 1) == "元" || newchar.charAt(newchar.length - 1) == "角")
        newchar = newchar + "整"
    //  document.write(newchar);
    return newchar;

}

function print_func() {
    /*var aa = $('.trainChargeTable').find('tr:eq(0)').find('td:eq(2)').text();
alert(aa);
return;
debugger;*/
    $('#content_id').css('display', 'block');

   // $('#big_amount').text(Arabia_to_Chinese($('#big_amount').text()))
    /*包含規費*/
    $('#content_id').print({
        //是否读取页面的样式
        globalStyles: true,
        //添加与attrbute media=打印的链接。
        mediaPrint: false,
        //在隐藏的iframe中打印。
        iframe: false,
        //不打印 的内容（选择器）
        noPrintSelector: ".avoid-this",
        //Add this at top
        prepend: "Hello World!!!<br/>",
        //Add this on bottom
        append: "<br/>Buh Bye!",
        //Log to console when printing is done via a deffered callback
        deferred: $.Deferred().done(function () {
            console.log('Printing done', arguments);
        })
    });
    $('#content_id').css('display', 'none');
    //$.print("#print-table-id");
}
</script>
</html>